package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;
import lombok.Getter;

/**
 * projectName: com.atguigu.lease.common.exception
 *
 * @author: Aiolin
 * description:
 * time: 2025/5/7 下午3:44
 */
@Getter
public class LeaseException extends RuntimeException{
    Integer code;
    public LeaseException(Integer code,String msg) {
        super(msg);
        this.code =code;
    }
    public LeaseException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "自定义异常：code="+code+";msg=" + this.getMessage();
    }
}
